package com.moshang.mall.product.exception;

import com.moshang.mall.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author xww
 * @Description //TODO
 * @Date 2020/9/7   9:22
 **/
@Slf4j
@RestControllerAdvice(basePackages = "com.moshang.mall.product.controller")
public class ProductExceptionControllerAdvice {

    @ExceptionHandler(value = Exception.class)
    public R HandlerException(Exception e){
        log.error("数据校验问题，异常类型:{}"+e.getMessage(),e.getClass());
        return R.error();
    }
}
